/**
 * Copyright (c) 2007,中企动力华南研发中心<br>
 * All rights reserved.
 */
package com.ce.pms.renovation.dao.impl;

import java.util.List;

import org.hibernate.Query;

import com.ce.pms.base.dao.impl.PmsBaseDaoImpl;
import com.ce.pms.renovation.dao.IDepositAccountApprovalDao;
import com.ce.pms.renovation.model.DepositAccountingApprovalDO;

/**
 * 功能描述：<br>
 * @author 罗军林 创建日期：2009-1-6
 */
public class DepositAccountApprovalDaoImpl extends PmsBaseDaoImpl<DepositAccountingApprovalDO> implements
		IDepositAccountApprovalDao {

	/**
	 * 功能描述:查询指定审批人、指定保证金核算结果ID审批记录<br>
	 * @param approvalId
	 * @param depositAccountId
	 * @return<br>
	 * Create author:罗军林<br>
	 * Create on:2009-1-6<br>
	 * Edit author:<br>
	 * Edit on:<br>
	 * Why:<br>
	 */
	public DepositAccountingApprovalDO getDepositAccountingApproval(Long approvalId,Long depositAccountId){
		String hql="FROM DepositAccountingApprovalDO appr where appr.approvalMan.id=? and appr.depositAccounting.id=?";
		Query query=createQuery(hql, approvalId,depositAccountId);
		return (DepositAccountingApprovalDO)query.uniqueResult();
	}

	/**
	 * 功能描述:查询指定保证金核算结果ID审批记录<br>
	 * 一条核算记录只会有一条审核结果
	 * @param approvalId
	 * @param depositAccountId
	 * @return<br>
	 * Create author:罗军林<br>
	 * Create on:2009-1-6<br>
	 * Edit author:<br>
	 * Edit on:<br>
	 * Why:<br>
	 */
	public DepositAccountingApprovalDO getDepositAccountingApproval(Long depositAccountId){
		String hql="FROM DepositAccountingApprovalDO appr where  appr.depositAccounting.id=?";
		Query query=createQuery(hql, depositAccountId);
//		List<DepositAccountingApprovalDO> result = query.list();
		return (DepositAccountingApprovalDO)query.uniqueResult();
	}
}
